<script setup>
import {getProjectHistoryList} from "@/api/project";
import {ref} from "vue";
import {toast} from "@/hook/toast";

const tableData = ref([])

async function initData(id) {
  const resp = await getProjectHistoryList({xiangmu_id: id})
  visible.value = true
  if (!resp.data) resp.data = []
  const {code, data, msg} = resp
  console.log(data, 'data')
  tableData.value = data
  if (code !== 1) return toast({title: msg, type: 'error'})
}

const visible = ref(false)

defineExpose({
  open: initData,
})
</script>

<template>
  <el-drawer title="人员分配历史"
             size="580px"
             v-model="visible"
  >
    <el-table :data="tableData" fit border>
      <el-table-column label="姓名" prop="name"></el-table-column>
      <el-table-column label="状态" prop="is_wancheng_text"></el-table-column>
      <el-table-column label="开始日期" prop="start_date"></el-table-column>
      <el-table-column label="结束日期" prop="end_date"></el-table-column>
    </el-table>
  </el-drawer>
</template>

<style scoped lang="scss">

</style>
